package com.tanhua.server.controller;

import com.tanhua.server.service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

public class BaiduController {

    @Autowired
    private BaiduService baiduService;


    /**
     * 上传地理位置
     * longitude 经度
     * latitude  纬度
     * addrStr  地理信息
     *
     * @param map
     * @return
     */
    @GetMapping("/location")
    public ResponseEntity location(@RequestBody Map map) {
        Double longitude = Double.valueOf(map.get("longitude").toString());
        Double latitude = Double.valueOf(map.get("latitude").toString());
        String addrStr = map.get("addrStr").toString();
        this.baiduService.location(longitude, latitude, addrStr);
        return ResponseEntity.ok(null);
    }
}
